package com.android.fragmentdemo.defineviews
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import com.android.fragmentdemo.R

class DotTextView @JvmOverloads constructor(context: Context, attributeSet: AttributeSet? = null) :
    AppCompatTextView(context, attributeSet) {

    private val mPaint by lazy {
        Paint().apply {
            isDither = true
            isAntiAlias = true
            color = context.resources.getColor(R.color.color_DC8717)
        }
    }

    private val radius = context.resources.getDimension(R.dimen.dp_3)

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        canvas.apply {
            drawCircle(
                radius,
                measuredHeight / 2F,
                radius,
                mPaint
            )
        }
    }
}